//
//  CHUploadCell.m
//  CarFile
//
//  Created by 陈浩 on 2017/7/12.
//  Copyright © 2017年 陈浩. All rights reserved.
//

#import "CHUploadCell.h"
@interface CHUploadCell()
@property (nonatomic ,strong) UILabel *titleLabel;    // 企业名称
@property (nonatomic ,strong) UILabel *levelLabel;  //  业务类别
@property (nonatomic ,strong) UILabel *linkmanLabel;
@property (nonatomic ,strong) UILabel *telLabel;
@property (nonatomic ,strong) UIView *bgView;
@property (nonatomic ,strong) UIView *line;
@property (nonatomic ,strong) UILabel *resultLabel;
@property (nonatomic ,strong) UILabel *dayLabel;
@property (nonatomic ,strong) UILabel *nouploadLabel;
@property (nonatomic ,strong) UIImageView *arrowImgView;
@property (nonatomic ,strong) UIButton *arrowBtn;

@end
@implementation CHUploadCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

+(instancetype)cellForTableView:(UITableView *)tableView{
    static NSString *ID = @"CHUploadCell";
    CHUploadCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell =[[CHUploadCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = KRGB(239, 239, 249);
        [self buildUI];
    }
    return self;
    
}

-(void)buildUI{
    
    self.bgView = [[UIView alloc] init];
    self.bgView.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.bgView];
    
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.text = @"杭州启奥行汽车服务有限公司";
    self.titleLabel.font =  [UIFont fontWithName:@"Helvetica-Bold" size:16];
    [self.bgView addSubview:self.titleLabel];
    
    self.levelLabel = [[UILabel alloc] init];
    self.levelLabel.text = @"业务类别：二类维修经营业务";
    self.levelLabel.font = [UIFont systemFontOfSize:14];
    self.levelLabel.textColor = [UIColor colorWithHexString:@"999999" alpha:1.0f];
    [self.bgView addSubview:self.levelLabel];
    
    self.linkmanLabel = [[UILabel alloc] init];
    self.linkmanLabel.text = @"联系人：杜巨君";
    self.linkmanLabel.font = [UIFont systemFontOfSize:14];
    self.linkmanLabel.textColor = [UIColor colorWithHexString:@"999999" alpha:1.0f];
    [self.bgView addSubview:self.linkmanLabel];
    
    self.telLabel = [[UILabel alloc] init];
    self.telLabel.text = @"电话：18258845998";
    self.telLabel.font = [UIFont systemFontOfSize:14];
    self.telLabel.textColor = [UIColor colorWithHexString:@"999999" alpha:1.0f];
    [self.bgView addSubview:self.telLabel];
    
}


-(void)setModel:(CHNouploadModel *)model{
    _model = model;
    self.titleLabel.text = model.name;
    self.linkmanLabel.text = [NSString stringWithFormat:@"联系人：%@",model.linkman];
    self.telLabel.text = [NSString stringWithFormat:@"电话：%@",model.busphone];
    self.resultLabel.text = model.noupdloadday;
    
    if ([model.levels isEqualToString:@"01"]) {
        self.levelLabel.text = @"业务类别：一类维修经营业务";
    }else if ([model.levels isEqualToString:@"02"]){
        self.levelLabel.text = @"业务类别：二类维修经营业务";
    }else{
        self.levelLabel.text = @"业务类别：三类维修经营业务";
    }
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    self.bgView.frame = CGRectMake(0, 0, UIScreenW, 100);
    self.titleLabel.frame = CGRectMake(15, 10, UIScreenW - 30, 30);
    self.levelLabel.frame = CGRectMake(15, CGRectGetMaxY(self.titleLabel.frame), UIScreenW - 30, 30);
    self.linkmanLabel.frame = CGRectMake(15, CGRectGetMaxY(self.levelLabel.frame), UIScreenW /2, 30);
    self.telLabel.frame = CGRectMake(UIScreenW /2, CGRectGetMaxY(self.levelLabel.frame), UIScreenW /2, 30);


}

@end
